// Context Summary Types
export interface ContextSummary {
  participants: string[];
  dialogueType: string;
}

// Emotional Timeline Types
export interface Emotion {
  type: 'positive' | 'negative' | 'neutral';
  intensity: number;
  relativeIntensity: number;
  confidence: string;
}

export interface DialogueTurn {
  turn: number;
  speaker: string;
  text: string;
  subText?: string;
  emotion: Emotion;
}

export interface TimelinePoint extends DialogueTurn {
  // Add any additional properties specific to TimelinePoint
}

export interface PragmaticFeature {
  featureType: string;
  example: string;
  interpretation: {
    meaning: string;
    confidence: string;
  };
}

export interface MotivationGoal {
  goal: string;
  confidence: string;
  supportingEvidence: string[];
}

export interface CriticalJunction {
  turn: number;
  description: string;
  triggers: string[];
  impactScore: number;
}

export interface DetectedIssue {
  type: string;
  evidence: string[];
  severity: number;
  confidence: string;
}

export interface RiskEvaluation {
  escalationRisk: number;
  degradationRisk: number;
}

export interface ImmediateAction {
  strategy: string;
  example: string;
  applicability: number;
}

export interface PreventiveMeasure {
  method: string;
  example: string;
  priority: string;
}

export interface NetworkNode {
  id: string;
  label: string;
  type: 'goal' | 'evidence';
  weight: number;
  user: string;
  x?: number;
  y?: number;
  fx?: number | null;
  fy?: number | null;
}

export interface NetworkLink {
  source: string;
  target: string;
  strength: number;
  type: 'supports' | 'conflicts';
}

export interface NetworkData {
  nodes: NetworkNode[];
  links: NetworkLink[];
}

export interface MotivationMatrix {
  [key: string]: MotivationGoal[];
}

export interface DialogueAnalysisReport {
  reportId: string;
  contextSummary: {
    participants: string[];
    dialogueType: string;
  };
  interactionAnalysis: {
    emotionalTimeline: DialogueTurn[];
    pragmaticFeatures: PragmaticFeature[];
  };
  strategicInsights: {
    motivationMatrix: MotivationMatrix;
    criticalJunctions: CriticalJunction[];
  };
  conflictAssessment: {
    detectedIssues: DetectedIssue[];
    riskEvaluation: RiskEvaluation;
  };
  optimizationRecommendations: {
    immediateActions: ImmediateAction[];
    preventiveMeasures: PreventiveMeasure[];
  };
}

// Default sample data
export const sampleAnalysisData: DialogueAnalysisReport = {
  reportId: "dialogue-analysis-001",
  contextSummary: {
    participants: ["man", "woman"],
    dialogueType: "情感交流"
  },
  interactionAnalysis: {
    emotionalTimeline: [
      {
        turn: 1,
        speaker: "man",
        text: "你怎么了？",
        emotion: {
          type: "neutral",
          intensity: 2,
          relativeIntensity: 0.5,
          confidence: "high"
        },
        subText: "关心询问"
      },
      {
        turn: 2,
        speaker: "woman",
        text: "嗯？",
        emotion: {
          type: "neutral",
          intensity: 1,
          relativeIntensity: 0.2,
          confidence: "high"
        },
        subText: "回避回应"
      },
      {
        turn: 3,
        speaker: "man",
        text: "为什么不说话？",
        emotion: {
          type: "neutral",
          intensity: 3,
          relativeIntensity: 0.7,
          confidence: "high"
        },
        subText: "进一步追问"
      },
      {
        turn: 4,
        speaker: "woman",
        text: "我也不知道......就是不想说吧。我本来也不是话多的人。",
        emotion: {
          type: "negative",
          intensity: 3,
          relativeIntensity: 0.8,
          confidence: "high"
        },
        subText: "情绪低落，自我解释"
      },
      {
        turn: 5,
        speaker: "man",
        text: "可是你以前很能聊的。",
        emotion: {
          type: "neutral",
          intensity: 3,
          relativeIntensity: 0.6,
          confidence: "high"
        },
        subText: "对比过去，寻找原因"
      },
      {
        turn: 6,
        speaker: "woman",
        text: "以前？可能是吧，有时候我也会和你说很多......",
        emotion: {
          type: "neutral",
          intensity: 2,
          relativeIntensity: 0.4,
          confidence: "high"
        },
        subText: "回忆过去，情绪缓和"
      },
      {
        turn: 7,
        speaker: "man",
        text: "那你现在为什么这么冷淡？是我做错什么了吗？",
        emotion: {
          type: "negative",
          intensity: 4,
          relativeIntensity: 0.9,
          confidence: "high"
        },
        subText: "自我怀疑，寻求解释"
      },
      {
        turn: 8,
        speaker: "woman",
        text: "不，你没有做错，是我自己的问题。",
        emotion: {
          type: "neutral",
          intensity: 3,
          relativeIntensity: 0.7,
          confidence: "high"
        },
        subText: "澄清责任，自我归因"
      },
      {
        turn: 9,
        speaker: "man",
        text: "你自己的问题？",
        emotion: {
          type: "neutral",
          intensity: 3,
          relativeIntensity: 0.6,
          confidence: "high"
        },
        subText: "进一步询问，寻求理解"
      },
      {
        turn: 10,
        speaker: "woman",
        text: "......我有很多重人格，有时候连我自己都无法控制自己的想法，所以我才会对你忽冷忽热的吧。",
        emotion: {
          type: "negative",
          intensity: 4,
          relativeIntensity: 0.9,
          confidence: "high"
        },
        subText: "揭示深层原因，情绪低落"
      }
    ],
    pragmaticFeatures: [
      {
        featureType: "回避",
        example: "我也不知道......就是不想说吧。",
        interpretation: {
          meaning: "避免直接回答问题",
          confidence: "high"
        }
      },
      {
        featureType: "隐喻",
        example: "我有很多重人格，有时候连我自己都无法控制自己的想法",
        interpretation: {
          meaning: "表达内心复杂和矛盾",
          confidence: "medium"
        }
      }
    ]
  },
  strategicInsights: {
    motivationMatrix: {
      "man": [
        {
          goal: "理解女人的情绪变化",
          confidence: "high",
          supportingEvidence: [
            "你怎么了？",
            "那你现在为什么这么冷淡？是我做错什么了吗？"
          ]
        }
      ],
      "woman": [
        {
          goal: "解释自己的情绪和行为",
          confidence: "high",
          supportingEvidence: [
            "我也不知道......就是不想说吧。",
            "我有很多重人格，有时候连我自己都无法控制自己的想法"
          ]
        }
      ]
    },
    criticalJunctions: [
      {
        turn: 10,
        description: "女人揭示自己有多重人格，解释了之前的情绪波动",
        triggers: ["我有很多重人格，有时候连我自己都无法控制自己的想法"],
        impactScore: 5
      }
    ]
  },
  conflictAssessment: {
    detectedIssues: [
      {
        type: "情绪对立",
        evidence: [
          "那你现在为什么这么冷淡？是我做错什么了吗？",
          "不，你没有做错，是我自己的问题。"
        ],
        severity: 3,
        confidence: "high"
      }
    ],
    riskEvaluation: {
      escalationRisk: 40,
      degradationRisk: 60
    }
  },
  optimizationRecommendations: {
    immediateActions: [
      {
        strategy: "情感确认",
        example: "我注意到你对我们的交流有些困扰，能和我多说说吗？",
        applicability: 80
      }
    ],
    preventiveMeasures: [
      {
        method: "议程设定",
        example: "我们可以定期交流，分享彼此的感受和想法",
        priority: "high"
      }
    ]
  }
};
